namespace ESupervision.Migrations
{
    using System;
    using System.Data.Entity.Migrations;
    
    public partial class ForumModels : DbMigration
    {
        public override void Up()
        {
            CreateTable(
                "dbo.ForumReply",
                c => new
                    {
                        ForumReplyID = c.Int(nullable: false, identity: true),
                        ForumReplyContent = c.String(nullable: false),
                        ForumReplyPostedTime = c.DateTime(nullable: false),
                        ForumReplyStatus = c.Boolean(nullable: false),
                        ForumReplyTopicID = c.Int(nullable: false),
                        ForumReplyPosterID = c.String(maxLength: 128),
                    })
                .PrimaryKey(t => t.ForumReplyID)
                .ForeignKey("dbo.AspNetUsers", t => t.ForumReplyPosterID)
                .ForeignKey("dbo.ForumTopic", t => t.ForumReplyTopicID, cascadeDelete: true)
                .Index(t => t.ForumReplyPosterID)
                .Index(t => t.ForumReplyTopicID);
            
            CreateTable(
                "dbo.ForumTopic",
                c => new
                    {
                        ForumTopicID = c.Int(nullable: false, identity: true),
                        ForumTopicTitle = c.String(nullable: false, maxLength: 250),
                        ForumTopicContent = c.String(nullable: false),
                        ForumTopicPostedTime = c.DateTime(nullable: false),
                        ForumTopicStatus = c.Boolean(nullable: false),
                        ForumTopicPosterID = c.String(maxLength: 128),
                    })
                .PrimaryKey(t => t.ForumTopicID)
                .ForeignKey("dbo.AspNetUsers", t => t.ForumTopicPosterID)
                .Index(t => t.ForumTopicPosterID);
            
        }
        
        public override void Down()
        {
            DropForeignKey("dbo.ForumReply", "ForumReplyTopicID", "dbo.ForumTopic");
            DropForeignKey("dbo.ForumTopic", "ForumTopicPosterID", "dbo.AspNetUsers");
            DropForeignKey("dbo.ForumReply", "ForumReplyPosterID", "dbo.AspNetUsers");
            DropIndex("dbo.ForumReply", new[] { "ForumReplyTopicID" });
            DropIndex("dbo.ForumTopic", new[] { "ForumTopicPosterID" });
            DropIndex("dbo.ForumReply", new[] { "ForumReplyPosterID" });
            DropTable("dbo.ForumTopic");
            DropTable("dbo.ForumReply");
        }
    }
}
